package de.hwrBerlin.dataMining.view.dialog;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

import de.hwrBerlin.dataMining.constants.Images;
import de.hwrBerlin.dataMining.constants.StyleConstants;
import de.hwrBerlin.dataMining.constants.UIConstants;

public class AboutDialogue extends Composite {

	public AboutDialogue(Composite pParent, int pStyle) {
		super(pParent, pStyle);
		createDialogue();
		createLabels();
	}

	private void createDialogue() {
		GridLayout gridLayout = new GridLayout(1, true);
		gridLayout.marginHeight = StyleConstants.ABOUT_MARGIN_HEIGHT;
		gridLayout.marginWidth = StyleConstants.ABOUT_MARGIN_WIDTH;
		setLayout(gridLayout);
	}

	private void createLabels() {
		Label titleLabel = new Label(this, SWT.NONE);
		titleLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
		titleLabel.setText(UIConstants.TITLE);
		titleLabel.setFont(new Font(getDisplay(), "Arial", 16, SWT.BOLD));

		Label versionLabel = new Label(this, SWT.NONE);
		versionLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
		versionLabel.setText(UIConstants.ABOUT_VERSION_LABEL);

		Label logoLabel = new Label(this, SWT.NONE);
		logoLabel.setImage(new Image(getDisplay(), Images.LOGO));
		logoLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));

		Label developerLabel = new Label(this, SWT.NONE);
		developerLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
		developerLabel.setText(UIConstants.DEVELOPER_LABEL);
		developerLabel.setFont(new Font(getDisplay(), "Arial", 13, SWT.BOLD));

		Composite developerComposite = new Composite(this, SWT.NONE);
		developerComposite.setLayout(new FillLayout(SWT.VERTICAL));
		developerComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));

		for (String developer : UIConstants.DEVELOPER_LIST) {
			Label developerNameLabel = new Label(developerComposite, SWT.NONE);
			developerNameLabel.setText(developer);
		}
	}
}
